<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
	<title>Single page app using Polymer</title>
	
    <!-- 1. Load platform support before any code that touches the DOM. -->
    <script src="bower_components/webcomponentsjs/webcomponents.min.js"></script>
    <link rel="stylesheet" href="resources/style/tutorial_style.css" shim-shadowdom>
    
    <!-- 2. Load the component using an HTML Import -->
    <link rel="import" href="bower_components/core-scaffold/core-scaffold.html">
	<link rel="import" href="bower_components/core-toolbar/core-toolbar.html">
	<link rel="import" href="bower_components/core-menu/core-menu.html">
	<link rel="import" href="bower_components/core-item/core-item.html">
	<link rel="import" href="bower_components/core-icons/core-icons.html">
	<link rel="import" href="bower_components/core-header-panel/core-header-panel.html">
	<link rel="import" href="bower_components/core-drawer-panel/core-drawer-panel.html">
	<link rel="import" href="bower_components/paper-item/paper-item.html">
	<link rel="import" href="bower_components/paper-tabs/paper-tabs.html">
	<link rel="import" href="bower_components/paper-icon-button/paper-icon-button.html">
    <link rel="import" href="bower_components/core-animated-pages/core-animated-pages.html">
	<link rel="import" href="bower_components/core-animated-pages/transitions/slide-from-right.html">
	
    <link rel="import" href="elements/my-element.html">
    <link rel="import" href="elements/proto-element.html">
    <link rel="import" href="elements/ready-element.html">
    <link rel="import" href="elements/name-tag.html">
    
  </head>
  <body unresolved fullbleed>
  <template is="auto-binding">
  
  <!-- Route controller. -->
  <flatiron-director route="{{route}}" autoHash></flatiron-director>
  
  <core-ajax id="ajax" auto url="{{selectedPage.page.url}}" handleAs="document"
  	on-core-response="{{onResponse}}">
  </core-ajax>
  
  <core-scaffold id="scaffold">
  	<nav>
		<core-toolbar>
			<div flex>Single Page Application1</div>
		</core-toolbar>
		<core-menu id="menu"  valueattr="hash" selected="{{route}}" selectedModel="{{selectedPage}}"
			on-core-select="{{menuItemSelected}}" on-click="{{ajaxLoad}}">
			<template repeat="{{page in pages}}">
				<paper-item hash="{{page.hash}}" noink>
					<core-icon icon="label{{route != page.hash ? '-outline' : ''}}""></core-icon>
					<a href="{{page.url}}">{{page.name}}</a>
				</paper-item>
			</template>
		</core-menu>
  	</nav>
  	
    <core-toolbar tool flex>
      <div flex>{{selectedPage.page.name}}</div>
      <core-icon-button icon="refresh"></core-icon-button>
      <core-icon-button icon="add"></core-icon-button>
    </core-toolbar>
  	
	<div layout horizontal center-center fit>
		<core-animated-pages id="pages" valueattr="hash" selected="{{route}}" transitions="slide-from-right"
			on-tap="{{cyclePages}}">
			<template repeat="{{page in pages}}">
				<section hash="{{page.hash}}" layout vertical center-center>
            		<div style="max-width:100%;">Loading...</div>
				</section>
			</template>
    	</core-animated-pages>
    </div>
  </core-scaffold>
  
  </template>
  
  <script src="resources/js/polymer_tutorial_app.js"></script>
	<script>
	  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
	  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
	  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
	  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
	  ga('create', 'UA-43475701-2', 'auto'); // ebidel's
	  ga('create', 'UA-39334307-1', 'auto'); // pp.org
	  ga('send', 'pageview');
	</script>
  </body>
</html>